<?php

function autoload($className)
{
    $dir = dirname(dirname(__FILE__));//定义根目录
    $file=$dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';
    if (is_file($file)) {
        require_once $file;
    } else {
        exit($file . ' is not exist');
    }
}

spl_autoload_register('autoload');